<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*
    注意最外层for循环是遍历列，内层for循环是遍历行。
  遇到不满足字母序的情况，就break跳出去
    */
    var minDeletionSize = function (strs) {
      const col = strs[0].length
      const row = strs.length
      let res = 0
      for (let j = 0; j < col; j++) {//列
        for (let i = 1; i < row; i++) { //行
          console.log(strs[i - 1][j])
          console.log(strs[i][j])
          if (strs[i - 1][j] > strs[i][j]) {
            res++
            break
          }
        }
      }
      return res
    };
    console.log(minDeletionSize(["cba", "daf", "ghi"]))
  </script>
</body>

</html>